From cf570f5b6b7fdd3c0a4fb4f4cf73c0c58611f6b7 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 14 May 2008 16:09:18 +0000 Subject: [PATCH] * (bug 14082) Fix for complex text input vs AJAX suggestions on some browsers The mwsuggest code was doing a blur(); focus() on the text field the first time a key was pressed, as a workaround for a problem with Firefox when the field was focused at page load time, as on Special:Search with no input given. Disabling of the browser's autosuggestion wasn't taking effect in Firefox without this workaround; however the extra blur() and focus() in some cases interrupted complex text input methods (for instance for Korean and Japanese), making it difficult to type in text. [Easily reproduceable in Safari on Mac.] Unfortunately there's no good way to check if a field is focused from JavaScript, so we can't just conditionally do the blur/focus. I've changed how Special:Search does its focus() of the input field; now instead of happening in raw immediate JS, it's done as a body onload handler -- this will run *after* mwsuggest.js does its setup, so by the time the field is forced focused, native autosuggest will be disabled. There might conceivably be a race condition if the user manages to manually focus the field while the page is still loading. Not sure what we can do about that. :D --- RELEASE-NOTES | 1 + includes/SpecialSearch.php | 7 +++++-- skins/common/mwsuggest.js | 15 ++------------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 39027e64de..16065f836d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -273,6 +273,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 14093) Do 'sysop' => 'protect' magic in Title::isValidMoveOperation * (bug 14063) Power search form missing